import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../interface/chat_room_leaf_interface.dart';
import '../tools/room_personal_data_page.dart';
import 'package:protobuf/protobuf.dart';

class CarListPageModel extends ChatRoomChangeNotifier {
  @override
  observeMessage(int messageId, data) {}

  @override
  onRootProxyModelCreated() {
    requestData();
  }

  // ChannelUserListRsp? data;

  requestData() async {
    // TypeRegistry typeRegistry = TypeRegistry([ChannelUserListRsp.getDefault()]);
    // Object? cacheData = await CacheUtil.getObject(CacheKeys.carListCacheKey);
    // if (cacheData != null) {
    //   data = ChannelUserListRsp.create()
    //     ..mergeFromProto3Json(cacheData,
    //         typeRegistry: typeRegistry, ignoreUnknownFields: true);
    //   notifyListeners();
    // }
    // var rsp = await RtcApi.instance
    //     .getChannelUserList(roomModel.channel!.channelId, 0, 200, scope: "vip");
    // if (rsp.isSuccess == true) {
    //   data = rsp.data;
    //   Object? map = data?.toProto3Json(typeRegistry: typeRegistry);
    //   CacheUtil.saveObject(CacheKeys.carListCacheKey, map);
    // }
    notifyListeners();
  }

  // onItemPressed(BuildContext context, SimpleChannelUser item) {
  //   RoomPersonalDataWidget.show(context, roomModel.channel, item);
  // }
}
